/**
 * 小方块类
 */

import { IPoint, IViewer } from "./types";

export class Square {
  // 显示者
  private _viewer?: IViewer;

  public get viewer(): IViewer | undefined {
    return this._viewer;
  }
  public get color(): string {
    return this._color;
  }
  public get point(): IPoint {
    return this._point;
  }
  public set viewer(value: IViewer | undefined) {
    this._viewer = value;
  }

  public changePoint(point: IPoint) {
    this._point = point;
    console.log("point", this._point, this._viewer);
    this._viewer?.show(this);
  }

  public constructor(private _point: IPoint, private _color: string) {}
}
